from collections import Counter


class Solution:
    def equalFrequency(self, word: str) -> bool:
        counter = [v for k, v in Counter(word).items()]
        for i in range(len(counter)):
            counter[i] -= 1
            cnt = Counter(counter)
            if len(cnt) == 1 or (len(cnt) == 2 and 0 in cnt):
                return True
            counter[i] += 1
        return False


s = Solution()
print(s.equalFrequency(word="abcc"))
print(s.equalFrequency(word="aca"))
# print(s.equalFrequency(word="abbcc"))
# print(s.equalFrequency(word="bac"))
# print(s.equalFrequency(word="abcc"))
